From: Michel Dänzer Date: Tue, 17 Mar 2026 17:01:20 +0000 (+0100) Subject: lightbox: Use triangular noise shape for dithering X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~10^2^2~92 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=16990045a4904c3ed8a4fe1ad10610aa2cc77b83;p=gnome-shell.git lightbox: Use triangular noise shape for dithering Highest density at 0.0, dropping off towards ±1.0. This makes the dithering noise slightly less noticeable in the dark corners of the vignette effect. The algorithm is taken from listing 1 of the Dithering section on https://momentsingraphics.de/BlueNoise.html . Part-of: --- diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js index e942676fb..fdba082c1 100644 --- a/js/ui/lightbox.js +++ b/js/ui/lightbox.js @@ -24,8 +24,9 @@ vec2 position = cogl_tex_coord_in[0].xy - 0.5; \n\ float t = clamp(length(1.41421 * position), 0.0, 1.0); \n\ float pixel_brightness = mix(1.0, 1.0 - vignette_sharpness, t); \n\ cogl_color_out.a *= 1.0 - pixel_brightness * brightness; \n\ -float noise_magnitude = (2.0 / ((1.0 - cogl_color_out.a) * 255.0)); \n\ -cogl_color_out.a += (rand(position) - 0.5) * noise_magnitude; \n'; +float noise = 2.0 * rand(position + 0.5) - 1.0; \n\ +noise = sign(noise) * (1.0 - sqrt(1.0 - abs(noise))); \n\ +cogl_color_out.a += noise / ((1.0 - cogl_color_out.a) * 255.0); \n'; const RadialShaderEffect = GObject.registerClass({